package com.mkx.multitier.routing;

import com.mkx.multitier.request.Request;

import java.util.HashMap;
import java.util.Map;

/**
 * 业务请求类，表示L2层处理的业务请求
 */
public class BusinessRequest {
    private final String requestId;
    private final String businessType;
    private final String subBusinessType;
    private final Map<String, Object> businessData;
    private final Request originalRequest;
    
    public BusinessRequest(String businessType, String subBusinessType, Map<String, Object> businessData, Request originalRequest) {
        this.requestId = originalRequest != null ? originalRequest.getRequestId() : java.util.UUID.randomUUID().toString();
        this.businessType = businessType;
        this.subBusinessType = subBusinessType;
        this.businessData = new HashMap<>(businessData);
        this.originalRequest = originalRequest;
    }
    
    public String getRequestId() {
        return requestId;
    }
    
    public String getBusinessType() {
        return businessType;
    }
    
    public String getSubBusinessType() {
        return subBusinessType;
    }
    
    public Map<String, Object> getBusinessData() {
        return businessData;
    }
    
    public Request getOriginalRequest() {
        return originalRequest;
    }
    
    @Override
    public String toString() {
        return "BusinessRequest{" +
                "requestId='" + requestId + "'" +
                ", businessType='" + businessType + "'" +
                ", subBusinessType='" + subBusinessType + "'" +
                ", businessData=" + businessData +
                '}';
    }
}
